package com.vexdev.logging;

import com.crashlytics.android.Crashlytics;

/**
 * Created by oslinux on 21/06/14.
 */
public class CrashlyticsRemoteLogger implements L.RemoteLogger {
    @Override
    public void onError(String tag, String errorMessage) {
        Crashlytics.log(errorMessage);
    }

    @Override
    public void onError(String tag, String errorMessage, Throwable throwable) {
        Crashlytics.log(errorMessage);
        Crashlytics.logException(throwable);
    }

    @Override
    public void onWarning(String tag, String message) {
        Crashlytics.log(message);
    }

    @Override
    public void onInfo(String tag, String message) {
        Crashlytics.log(message);
    }

    @Override
    public void onDebug(String tag, String message) {
        Crashlytics.log(message);
    }

    @Override
    public void onVerbose(String tag, String message) {
        Crashlytics.log(message);
    }

    @Override
    public void onAnchor(String anchorName) {
        Crashlytics.setString("anchor", anchorName);
    }

    @Override
    public void onKey(String key, String value) {
        Crashlytics.setString(key, value);
    }

    @Override
    public void onUserID(String uid) {
        Crashlytics.setUserIdentifier(uid);
    }

    @Override
    public void onUsername(String username) {
        Crashlytics.setUserName(username);
    }

    @Override
    public void onUserEmail(String email) {
        Crashlytics.setUserEmail(email);
    }
}
